module executor.friend.ApplyContactExecutor;

import msgtrans;
import message.Constants;
import message.MsgDefine;
import google.protobuf;
import hunt.logging;
import std.array;
import std.conv : to;
import hunt.util.Serialize;
import client.GateServerClient;
import client.MsgServerClient;
import service.ContactsService;
import service.ApplyService;

@TransportServer(LogicServerName)
class ApplyContactExecutor : AbstractExecutor!(ApplyContactExecutor){

  //申请好友接口
  @MessageId(MESSAGE.CMD_APPLY_FRIEND_REQ)
  void applyFriend(TransportContext ctx, MessageBuffer buffer) {
    auto req = new ApplyContact();
    buffer.data.fromProtobuf!ApplyContact(req);
    ApplyService.dealApplyContancsReq(req);
    //if (req.chatId !is null)
    //{
    //  TransportSession msgClient =  MsgServerClient.getInstance().getForwardClient(to!int(req.toId));
    //  msgClient.send(new MessageBuffer(MESSAGE.CMD_APPLY_FRIEND_REQ,req.toProtobuf.array));
    //}
  }
}

